<!DOCTYPE HTML>
<html>
<head>
	<title>pixi.js example 8 Dragging</title>
	<style>
		body {
			margin: 0;
			padding: 0;
			background-color: #FFFFFF;
			
		}
		
		.textHolder{
			width: 400px;
		}
	</style>
	<script src="pixi.js"></script>
    <script src="texturelib.js"></script>
    <script src="darren.js"></script>
    <script src="ahad.js"></script>
    <script src="andre.js"></script>
	<script src="bomb.js"></script>
</head>
<body>
	<script>
//globals
var bRoundStarted = true;
var countdown = 30;

// create an new instance of a pixi stage
var loader = new PIXI.AssetLoader(assetsToLoader);
loader.onComplete = onAssetsLoaded
loader.load();
var stage = new PIXI.Stage(0x97c56e, true);

// create a renderer instance
var renderer = PIXI.autoDetectRenderer(window.innerWidth, window.innerHeight, null);

// add the renderer view element to the DOM
document.body.appendChild(renderer.view);
renderer.view.style.position = "absolute";
renderer.view.style.top = "0px";
renderer.view.style.left = "0px";

// create a background..
var background = PIXI.Sprite.fromImage("grid.png");
background.position.x = background.position.y = 64;
// add background to stage..
stage.addChild(background);

// create a texture from an image path

function loadGame() {
    for (var i = 0; i < 10; i++) {
        Goat(64 + Math.random() * 352, 64, stage)
    };

    var myBullet = CreateProjectile(64, 64, stage);
    var myBomb = CreateBomb(128, 128, stage);

    myBomb.owner ="GOODGUY";

    //displays right side of screen
    var stats = new StatsDisplay();
    //displays health bar
    var healthbar = new HealthBar();

    healthbar.display();
    stats.displayText();
    stats.setIcon();

    requestAnimFrame(animate);
}

function animate() {

    requestAnimFrame(animate);
    if (bRoundStarted == true) {
        if (countdown % 5 == 0) {
            updateProjectiles();
			updateBombs();
            checkColissions();
			checkBombColissions();
        }

if (countdown == 0) {
    updateEnemies();
            countdown = 30;
        }
        else
            countdown--;
        runGUIMethods();
    }
    //stage.interactionManager.update();
    // render the stage   
    renderer.render(stage);
}

	</script>

	</body>
</html>
